// copyright 1993 Michael B. Johnson; some portions copyright 1994, MIT
// see COPYRIGHT for reuse legalities
//


#import "WWShaderArgTextField.h"

@implementation WWShaderArgTextField

+ initialize { return [WWShaderArgTextField setVersion:1], self; }

- initFrame:(const NXRect *)r 
{
   [super initFrame:r];
   shaderArgName = NULL;
   return self;
}

- awake
{
   [super awake];
   shaderArgName = NULL;
   return self;
}

- free
{
  if (shaderArgName) {  free(shaderArgName); }
  return [super free];
}
  
- setShaderArgName:(const char *)newShaderArg
{
  if (shaderArgName) 
  {  free(shaderArgName);
  }
  shaderArgName = NXCopyStringBuffer(newShaderArg);
  return self;
}

- (const char *)shaderArgName { return (const char *)shaderArgName; }

#define typeVector "*"
#define typeValues &shaderArgName

- read:(NXTypedStream*)stream 
{
  int version;


  [super read:stream];

  version = NXTypedStreamClassVersion(stream,"WWShaderArgTextField");
  if (version == 0) NXReadTypes(stream,"i",&version), version=1;
  if (version == 1)
  {  NXReadTypes(stream, typeVector, typeValues);
  }
  return self; 
}

- write:(NXTypedStream*)stream 
{
  [super write:stream];

  NXWriteTypes(stream,typeVector, typeValues);
  return self;
}

@end
